<div class="row project">
	<div class="col-sm-8">
		<div class="page-header">
			<h2>项目:&nbsp;{{project.name}}</h2>
		</div>
		<button class="btn btn-danger pull-right"
			ng-hide="isRemoving"
			ng-click="isRemoving=true">删除</button>
		<div class="input-group pull-right" style="width:220px" ng-show="isRemoving">
			<span class="input-group-btn">
				<button class="btn btn-primary"
					ng-click="isRemoving=false">取消</button>
			</span>
			<form ng-submit="removeProjectEnter()" style="margin:0">
				<input type="text" class="form-control" placeholder="输入 DELETE"
					ng-model="deleteWord"/>
			</form>
			<span class="input-group-btn">
				<button class="btn btn-danger"
					ng-click="removeProject()"
					ng-disabled="deleteWord!=='DELETE'">确定</button>
			</span>
		</div>
		<h3>属性</h3>
		<form ng-submit="updateProject()" name="projectOption">
			<div class="row">
				<div class="form-group col-sm-10">
					<label for="">项目名称</label>
					<div class="input-group">
						<span class="input-group-btn">
							<a class="btn" id="project-public-setter"
								ng-class="projectData.public?'btn-success':'btn-primary'"
								ng-click="projectData.public=!projectData.public"><span
									ng-class="{'glyphicon-book':projectData.public,'glyphicon-lock':!projectData.public}"
									class="glyphicon"></span>&nbsp;{{projectData.public?'公开':'私有'}}</a>
						</span>
						<input class="form-control" type="text"
							name="name"
							required ng-maxlength="255"
							id="project-name"
							ng-model="projectData.name" />
					</div>
					<p class="help-block" ng-messages="projectOption.name.$error">
						<span ng-message="required">项目名不为空</span>
						<span ng-message="maxlength">不超过255个字符</span>
					</p>
				</div>
				<div class="form-group col-sm-2">
					<label for="">当前版本</label>
					<input class="form-control" type="text"
						id="project-version"
						name="version"
						required ng-pattern="/^\d{1,2}\.\d{1,2}\.\d{1,2}$/"
						ng-model="projectData.version" />
					<p class="help-block" ng-messages="projectOption.version.$error">
						<span ng-message="required">起始版本不能为空</span>
						<span ng-message="pattern">非法语义版本格式</span>
					</p>
				</div>
			</div>
			<div class="form-group">
				<label>注释</label>
				<textarea class="form-control" ng-model="projectData.comment"
					id="project-comment"></textarea>
			</div>
			<button class="btn btn-primary"
				id="project-update-button"
				type="submit"
				ng-disabled="project.name==projectData.name
					&&project.version==projectData.version
					&&project.comment==projectData.comment
					&&project.public==projectData.public
					||!projectOption.$valid">保存修改</button>
		</form>
		<h3><span class="hidden-xs">探针&nbsp;&amp;&nbsp;</span>令牌</h3>
		<form>
			<div class="row">
				<div class="form-group hidden-xs col-sm-6">
					<label>探针ID</label>
					<input class="form-control" readonly
						id="project-probe-id"
						ng-value="project.probeId"
						form-selector />
				</div>
				<div class="form-group col-sm-6">
					<label style="width:100%;">令牌&nbsp;&nbsp;<small><a
						href="#/docs#docs7">为什么？</a></small><span
							class="pull-right">{{(token.expiredtime?token.expiredtime:'-')|date:'yyyy-MM-dd'}}过期</span></label>
					<div class="input-group">
						<input type="text" readonly
							form-selector
							id="token-code"
							class="form-control"
							ng-value="token.token?token.token:'没有有效的令牌'" />
						<span class="input-group-btn">
							<button class="btn btn-primary"
								id="token-put-button"
								ng-click="createToken()"
								ng-hide="token.token">申请令牌</button>
							<button class="btn btn-warning"
								id="token-del-button"
								ng-click="removeToken()"
								ng-show="token.token">取消令牌</button>
						</span>
					</div>
				</div>
			</div>
			<div class="form-group hidden-xs">
				<label>探针部署地址</label>
				<div class="input-group">
					<input
						id="project-probe-path"
						class="form-control"
						ng-model="projectData.probePath" />
					<span class="input-group-btn">
						<button class="btn btn-primary"
							id="probe-path-update"
							type="button"
							ng-click="updateProject()"
							ng-disabled="project.probePath==projectData.probePath">更新</button>
					</span>
				</div>
			</div>
			<p class="help-block hidden-xs">
				<strong>例如：</strong>
				<a ng-click="projectData.probePath='http://localhost/probe.html'">http://localhost/probe.html</a>
				<a ng-click="projectData.probePath='http://127.0.0.1/probe.html'">http://127.0.0.1/probe.html</a>
			</p>
		</form>
		<h3>资源</h3>
		<div class="btn-group">
			<a ng-href="#/project/{{project.projectId}}/task"
				class="btn btn-primary" id="task-list-jumpto">
			<span class=" glyphicon glyphicon-tasks"></span>&nbsp;&nbsp;测试任务</a>
		</div>
	</div>
	<div id="sideBar" class="col-sm-3 col-sm-offset-1 hidden-xs">
		<h4>启动</h4>
		<p>
			<a class="btn btn-success hidden-xs" target="_blank"
				ng-href="{{project.getUrl(false, token.token)}}"
				ng-show="project.isProbeValid(token.token)">
				<span class="glyphicon glyphicon-play"></span>&nbsp;启动探针</a>
			<a class="btn btn-danger hidden-xs"
				ng-hide="project.isProbeValid(token.token)" disabled>
				<span class="glyphicon glyphicon-stop"></span>&nbsp;配置错误</a>
		</p>
		<p>复制启动地址（ctrl+c）</p>
		<textarea class="form-control"
			style="height:120px;resize:none"
			form-selector
			ng-show="project.isProbeValid(token.token)"
			readonly>{{project.getUrl(false, token.token)}}</textarea>
		<pre class="form-control"
			style="height:120px;resize:none"
			ng-hide="project.isProbeValid(token.token)"
			disabled>可能的原因：<br/>1.探针配置地址不合法<br/>2.缺少有效的令牌</pre>
		<h4>还没有部署？</h4>
		<p><a class="btn btn-default"
			target="_blank"
			href="/lemon-probe.zip"><span
				class="glyphicon glyphicon-download-alt">
			</span>&nbsp;下载&nbsp;LemonProbe.zip</a>
		</p>
		<p>
			如何使用？<strong><a href="#/docs">查看帮助</a></strong><br/>
			<ol>
				<li>下载探针包&nbsp;(LemonProbe.zip)</li>
				<li>释放内容到开发服务器根目录</li>
				<li>回到此页面配置部署地址</li>
			</ol>
		</p>
		<h4>审阅用例</h4>
		<p><a ng-href="#/project/{{project.projectId}}/case"
			class="btn btn-primary" id="case-list-jumpto">
			<span class="glyphicon glyphicon-book"></span>&nbsp;&nbsp;用例库</a>
		</p>
	</div>
</div>
